In this vignette, you will find out about pre-set visualisations in AHgen:

  • Section 1 - Visualising the Abstraction Hierarchy
  • Section 2 - Visualising and exploring results

To navigate to other vignettes, go to Vignette 0 - Welcome to AHgen.

1. Visualising the Abstraction Hierarchy

This section will cover pre-set visualisations for the Abstraction Hierarchy itself.

First we need to create a key to specify the positioning of vertices, in AHgen called a visKey. This could also be done in a .xlsx file externally and imported into R.

visKey =
  tribble(
    ~layer, ~min, ~max, ~addR, ~r,
    1,250,290,0,1,
    2,250,290,0,2,
    3,260,280,0,3,
    4,260,280,0,4,
    5,250,290,0,5)

visKey
## # A tibble: 5 × 5
##   layer   min   max  addR     r
##   <dbl> <dbl> <dbl> <dbl> <dbl>
## 1     1   250   290     0     1
## 2     2   250   290     0     2
## 3     3   260   280     0     3
## 4     4   260   280     0     4
## 5     5   250   290     0     5

The vis_AH_layout() function generates a layout for visualising an Abstraction Hierarchy i.e. five-level hierarchical network.

It has five input arguments:

  • edgelist - the edge list of the network to be visualised
  • vInfo - the vertex information
  • minSpacing - the minimum spacing between nodes; by default this is set to minSpacing = 0
  • maxSpacing - the maximum spacing between nodes; by default this is set to maxSpacing = 100
  • key - the key to specify the visualisation layout
plot_layout = 
  vis_AH_layout(edgelist = de,
                vInfo = dv,
                minSpacing = 0, 
                maxSpacing = 1000,
                key = visKey)

plot_layout
## $edges
## # A tibble: 20 × 9
##    from.level to.level layer      from     to            x     y      xend  yend
##         <dbl>    <dbl> <chr>      <chr>    <chr>     <dbl> <dbl>     <dbl> <dbl>
##  1          1        2 l1FP_l2VPM Provide… Incr… -1.84e-16 -1    -6.84e- 1 -1.88
##  2          1        2 l1FP_l2VPM Provide… Road… -1.84e-16 -1    -3.67e-16 -2   
##  3          2        2 l2VPM_l3GF Increas… Comp… -6.84e- 1 -1.88  6.84e- 1 -1.88
##  4          2        3 l2VPM_l3GF Increas… Effe… -6.84e- 1 -1.88 -5.21e- 1 -2.95
##  5          2        3 l2VPM_l3GF Increas… Safe… -6.84e- 1 -1.88 -5.51e-16 -3   
##  6          2        2 l2VPM_l3GF Road us… Comp… -3.67e-16 -2     6.84e- 1 -1.88
##  7          2        3 l2VPM_l3GF Road us… Effe… -3.67e-16 -2    -5.21e- 1 -2.95
##  8          2        3 l2VPM_l3GF Road us… Safe… -3.67e-16 -2    -5.51e-16 -3   
##  9          2        3 l3GF_l4ORP Complia… Driv…  6.84e- 1 -1.88  5.21e- 1 -2.95
## 10          2        4 l3GF_l4ORP Complia… Road…  6.84e- 1 -1.88 -6.95e- 1 -3.94
## 11          2        4 l3GF_l4ORP Complia… Vehi…  6.84e- 1 -1.88  6.95e- 1 -3.94
## 12          3        3 l3GF_l4ORP Effecti… Driv… -5.21e- 1 -2.95  5.21e- 1 -2.95
## 13          3        4 l3GF_l4ORP Effecti… Road… -5.21e- 1 -2.95 -6.95e- 1 -3.94
## 14          3        4 l3GF_l4ORP Effecti… Vehi… -5.21e- 1 -2.95  6.95e- 1 -3.94
## 15          3        3 l3GF_l4ORP Safe ef… Driv… -5.51e-16 -3     5.21e- 1 -2.95
## 16          3        4 l3GF_l4ORP Safe ef… Road… -5.51e-16 -3    -6.95e- 1 -3.94
## 17          3        4 l3GF_l4ORP Safe ef… Vehi… -5.51e-16 -3     6.95e- 1 -3.94
## 18          3        5 l4ORP_l5PO Driver … Vehi…  5.21e- 1 -2.95 -9.18e-16 -5   
## 19          4        5 l4ORP_l5PO Road Tr… Vehi… -6.95e- 1 -3.94 -9.18e-16 -5   
## 20          4        5 l4ORP_l5PO Vehicle… Vehi…  6.95e- 1 -3.94 -9.18e-16 -5   
## 
## $vertices
## # A tibble: 10 × 6
##    level Node                                                x     y   pos theta
##    <dbl> <chr>                                           <dbl> <dbl> <int> <dbl>
##  1     1 Provide efficient and accessible mobility   -1.84e-16 -1        1  4.71
##  2     2 Increased road user safety                  -6.84e- 1 -1.88     1  4.36
##  3     2 Road user satisfaction                      -3.67e-16 -2        2  4.71
##  4     2 Compliant user behaviour                     6.84e- 1 -1.88     3  5.06
##  5     3 Effective occupant protection               -5.21e- 1 -2.95     1  4.54
##  6     3 Safe efficient traffic flow                 -5.51e-16 -3        2  4.71
##  7     3 Driver capabilities and limitations          5.21e- 1 -2.95     3  4.89
##  8     4 Road Transportation System capabilities an… -6.95e- 1 -3.94     1  4.54
##  9     4 Vehicle capacity                             6.95e- 1 -3.94     2  4.89
## 10     5 Vehicle components                          -9.18e-16 -5        1  4.71

The function vis_AH_ggplot() generates a standard ggplot.

It has input arguments:

  • layout - a layout generated by vis_AH_layout()
  • key - the key to specify the visualisation layout; by default this is set to key = NULL
  • vecOpacity - a vector of four numeric values representing the opacity of edges in each layer; by default this is set to vecOpacity = c(1, 1, 1, 1)
  • vecSize - a vector of five numeric values representing the size of vertices in each level; by default this is set to vecSize = c(5, 4, 3.5, 3, 2.5)
plot_ggplot = 
  vis_AH_ggplot(layout = plot_layout, 
                key = visKey)
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## ℹ The deprecated feature was likely used in the AHgen package.
##   Please report the issue to the authors.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
plot_ggplot

Lastly is the function vis_AH_plotly(). Functions from the package plotly are used within vis_AH_plotly() to enable the visualisation to be interactive.

It has four input arguments:

  • ggplotPlot - the plot generated with vis_AH_ggplot()
  • layerNames - a vector of four character strings to be used as identifiers for Abstraction Hierarchy layers; by default this is set to layerNames = c("Layer 1-2 - Purposes-Outcomes", "Layer 2-3 - Outcomes-Tasks", "Layer 3-4 - Tasks-Processes", "Layer 4-5 - Processes-Resources")
  • levelNames - a vector of five character strings to be used as identifiers for Abstraction Hierarchy levels; by default this is set to levelNames = c("Level 1 - Purposes", "Level 2 - Outcomes", "Level 3 - Tasks", "Level 4 - Processes", "Level 5 - Resources")
  • circles - whether the visualisation should be circular; by default this is set to circles = TRUE
plot_plotly = 
  vis_AH_plotly(ggplotPlot = plot_ggplot)

plot_plotly

Using the building blocks above, it is possible to create an interactive version of an Abstraction Hierarchy. Below you can explore the AHexploreR, an application of this for a generic UK city (the Urban Systems Abstraction Hierarchy, or USAH). You can find all underlying code for the AHexploreR, to adapt for your own interactive Abstraction Hierarchy, on GitHub here.

2. Visualising the results

This section covers pre-set output styles to visualise and explore the results of network analysis on Abstraction Hierarchies. These are fairly bespoke styles which can be adapted for your own purposes.

2.1. Plots

2.2. Tables

It is sometimes useful to summarise results in a table format for reports and academic papers. AHgen has several preset functions for this.

Last updated

This vignette is associated with AHgen v1.0.0, and was last updated by Melissa Bedinger on 2023-07-21.